<template></template>

<script setup name="VxeModal" lang="jsx">
import { VXETable } from 'vxe-table';

class EvDialog {
  info(title, content, options) {
    return VXETable.modal.alert(content, title, { ...options, status: 'info' });
  }
  warning(title, content, options) {
    return VXETable.modal.alert(content, title, {
      ...options,
      status: 'warning',
    });
  }
  question(title, content, options) {
    return VXETable.modal.alert(content, title, { ...options, status: 'question' });
  }
  success(title, content, options) {
    return VXETable.modal.alert(content, title, { ...options, status: 'success' });
  }
  error(title, content, options) {
    return VXETable.modal.alert(content, title, { ...options, status: 'error' });
  }

  confirm(title, content, options) {
    return new Promise((resolve) => {
      VXETable.modal.confirm(content, title, { ...options }).then((type) => {
        type === 'confirm' && resolve();
      });
    });
  }
}

window['$EvDialog'] = new EvDialog();
Object.freeze(window.$EvDialog);
Object.defineProperty(window, '$EvDialog', {
  configurable: false,
  writable: false,
});
</script>
<style>
.type--confirm,
.type--alert {
  .vxe-modal--footer {
    border-top: none !important;
  }
}
</style>
<style scoped lang="scss"></style>
